package org.orarriinae.common.log;

import lombok.Getter;
import org.springframework.context.ApplicationEvent;

/**
 * 日志事件
 *
 * @author Wang Chengwei
 * @since 1.0
 */
public class LogEvent extends ApplicationEvent {

    /**
     * 日志类型
     */
    @Getter

    private String logType;

    /**
     * 修改前数据
     */
    @Getter
    private Object oldData;

    /**
     * 修改后数据
     */
    @Getter
    private Object newData;

    /**
     * 备注
     */
    @Getter
    private String remark;

    @Getter
    private Integer userId;

    public LogEvent(Object source) {
        super(source);
    }

    public LogEvent(Object source, Integer userId, String logType, Object oldData, Object newData, String remark) {
        super(source);
        this.userId = userId;
        this.logType = logType;
        this.oldData = oldData;
        this.newData = newData;
        this.remark = remark;
    }

    public LogEvent(Object source, String logType, Object oldData, Object newData, String remark) {
        super(source);
        this.logType = logType;
        this.oldData = oldData;
        this.newData = newData;
        this.remark = remark;
    }

    public LogEvent(Integer userId, Object source, String logType, Object oldData, Object newData) {
        super(source);
        this.userId = userId;
        this.logType = logType;
        this.oldData = oldData;
        this.newData = newData;
        this.remark = null;
    }

    public LogEvent(Object source, String logType, Object oldData, Object newData) {
        super(source);
        this.logType = logType;
        this.oldData = oldData;
        this.newData = newData;
        this.remark = null;
    }

}
